#include<iostream>

#include "search.h"


int search::binarySearch(int arr[], int search, int size) {
	int low = 0, high = low + size - 1;
	while (low <= high) {
		int mid = (high + low) / 2;
		if (arr[mid] == search) {
			return mid;
		}
		if (arr[mid] < search)
			low = mid + 1;
		else if (arr[mid] > search)
			high = mid - 1;
	}
	return -1;
}
